﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Pout_Porri
{
    public class Camera
    {
        private Vector2 position;
        public Vector2 Position
        {
            get { return position; }
            set { position = value; }
        }

        private float rotation;
        public float Rotation
        {
            get { return rotation; }
            set { rotation = value; }
        }

        private float zoom;
        public float Zoom
        {
            get { return zoom; }
            set { zoom = value; }
        }

        public Camera()
        {

        }

        public void Update(Vector2 range)
        {
            position += range;
        }

        public Matrix getWorldMatrix(GraphicsDevice device)
        {
            return
                Matrix.CreateRotationZ(rotation) *
                Matrix.CreateScale(new Vector3(zoom, zoom, 1)) *
                Matrix.CreateTranslation(new Vector3(device.Viewport.Width * 0.5f, device.Viewport.Height * 0.5f, 0))*
                Matrix.CreateTranslation(new Vector3(-position.X, -position.Y, 0));
        }
    }
}
